<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div>这是div</div>
    <input type="text" id="i1">
    <input type="button" value="按钮" onclick="f()">
    <script>
        function f() {
            //得到输入框
            let i = document.querySelector("#i1");
            //得到div
            let d = document.querySelector("div");
            //取出输入框中的值并赋值给div
            d.innerText = i.value;;

        }
    </script>
</body>
</html>